package com.zgy.myshellcommand.config;


import com.zgy.myshellcommand.capabilities.WriteToExcel;
import com.zgy.myshellcommand.capabilities.impl.WriteToExcelImplByPoi;
import com.zgy.myshellcommand.commandentity.FileToExcelEntity;
import com.zgy.myshellcommand.commandentity.SheetConfigEntity;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;

@Configuration
public class FileToExcelConfig {

    @Bean
    WriteToExcel writeToExcelImplByPoi(){
        return new WriteToExcelImplByPoi();
    }

    @Bean
    SheetConfigEntity sheetConfig(){
        return new SheetConfigEntity();
    }
    @Bean
    FileToExcelEntity fileToExcelEntity(SheetConfigEntity sheetConfigEntity){
        ArrayList<SheetConfigEntity> sheetConfigEntities = new ArrayList<>();
        sheetConfigEntities.add(sheetConfigEntity);
        FileToExcelEntity fileToExcelEntity = new FileToExcelEntity();
        fileToExcelEntity.setSheetConfigEntities(sheetConfigEntities);
        return fileToExcelEntity;
    }

}
